# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=konsole
pkgver=23.08.4
pkgrel=0
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://kde.org/applications/system/konsole"
pkgdesc="KDE's terminal emulator"
license="GPL-2.0-only AND LGPL-2.1-or-later AND Unicode-DFS-2016"
depends="ncurses-terminfo-base"
makedepends="
	extra-cmake-modules
	kbookmarks5-dev
	kcompletion5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kcoreaddons5-dev
	kcrash5-dev
	kdbusaddons5-dev
	kdoctools5-dev
	kglobalaccel5-dev
	kguiaddons5-dev
	ki18n5-dev
	kiconthemes5-dev
	kinit5-dev
	kio5-dev
	knewstuff5-dev
	knotifications5-dev
	knotifyconfig5-dev
	kparts5-dev
	kpty5-dev
	kservice5-dev
	ktextwidgets5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	kxmlgui5-dev
	qt5-qtbase-dev
	qt5-qtmultimedia-dev
	samurai
	"
checkdepends="mesa-dri-gallium xvfb-run"
_repo_url="https://invent.kde.org/utilities/konsole.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/konsole-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DENABLE_PLUGIN_SSHMANAGER=ON
	cmake --build build
}

check() {
	cd build

	# DBusTest requires running DBus
	local skipped_tests="("
	local tests="
		DBus
		History
		"
	case "$CARCH" in
		armv7)
			tests="$tests Part"
			;;
	esac
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)Test"
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7b6e8a3190290b82283adaf8da59cd41f14da9350ad8baa6340e37d8e8021c65694bda09b89ad3bcbf490a932ab16b2fc3182c0cafa70df189353dfc807cb5dc  konsole-23.08.4.tar.xz
"
